home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
smaltalk
/
stv.lha
/
STV
/
ISA
/
carolina
/
errorhnd.st
< prev
next >
Wrap
Text File
|
1993-07-23
|
2KB
|
60 lines
"evaluate the following code to install
ErrorHandler. source: SCOOP Spring '89"
"[1//0] ifError:
[:aString |
aString = 'divisor is zero'
ifTrue: [0]
ifFalse: [
self error: aString]]"
"*******************************************"
Process class compile:
'allInstances
^Array new'.
OrderedCollection subclass: #Process
instanceVariableNames:
'topFrame frameBias priority
sendFrame isUserIF debugger
name interruptFrame
errorHandler'
classVariableNames: ''
poolDictionaries: ''.
Process class removeSelector:
#allInstances.
Processor initialize.
"*******************************************"
"Install the following methods"
"Object methods ****************************"
error: aString
"Create a walkback window describing an
error condition with the error message
aString in the window label"
CurrentProcess isErrorHandled
ifTrue: [CurrentProcess errorHandler
value: aString].
Process queueWalkback: aString
makeUserIF: CurrentProcess
isUserIF resumable: false
"Process methods ***************************"
errorHandler
^errorHandler
errorHandler: aBlock
errorHandler := aBlock
isErrorHandled
^errorHandler notNil
"Context methods ***************************"
ifError: aBlock
|errorBlock lastHandler |
lastHandler := CurrentProcess
errorHandler.
errorBlock := [:aString |
CurrentProcess errorHandler:
lastHandler.
^aBlock value: aString].
currentProcess errorhandler:
errorBlock.
self value.
CurrentProcess errorHandler:
lastHandler